package jiang.app.service;

import javax.annotation.Resource;

import jiang.app.dao.ICandidateDao;
import jiang.app.entity.Candidate;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

@Component
public class UpdateInformationService {
	@Resource
	ICandidateDao candidateDao;
	@Resource
	RecommendService recommendService;
	
	public Candidate findCandidateByIDCard(String idcard){
		return candidateDao.selectCandidateByIDCardNumber(idcard);
	}
	
	@Transactional
	public boolean updateCandidate(Candidate c){
		try{
			candidateDao.updateCandidateByIDCardNumber(c);
		}
		catch(Exception e){
			e.printStackTrace();
			return false;
		}
		return true;
	}
	
	public boolean saveResume(MultipartFile origin, String savePath){
		return recommendService.saveResume(origin, savePath);
	}
}
